﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Security.Authorizations
{
    [DataContract(Name = "Scope", Namespace = "http://schemas.authorizations.org/2010/12/Scope")]
    public class Scope
    {
        [DataMember(Name = "permissions")]
        public Permissions permissions { get; private set; }

        [DataMember(Name = "name")]
        public string name { get; private set; }


        [DataMember(Name = "HasAccess")]
        public bool HasAccess
        {
            get
            {
                if (permissions == null)
                    return false;

                if (permissions.extendedPermissions.Length > 0)
                    return true;

                return false;
            }

            private set { }
        }

        public Scope(string name, Permissions permissions)
        {
            this.name = name;
            this.permissions = permissions;
        }

    }
}
